<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/wx/page/session.jsp"%>
<c:set var="userId" value="${param.userId}" />
<c:set var="deptId" value="${param.deptId}" />
<c:set var="deptCode" value="${param.deptCode}" />
<c:set var="deptParentId" value="${param.deptParentId}" />
<c:set var="staffType" value="${param.staffType}" />
<c:set var="taskId" value="${param.taskId}" />
<c:set var="taskType" value="${param.taskType}" />
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <title>任务货主管理</title>
    <link rel="stylesheet" href="${ctx}/wx/css/default.css"/>
    <link rel="stylesheet" href="${ctx}/wx/css/xtable.css"/>
    <script type="text/javascript" src="${ctx}/wx/js/xtable.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
    <script type="text/javascript" src="${ctx}/wx/js/alert.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/interface/UserService.js"></script>
</head>
<body>
<p class="contact-input">
    <input type="search" id="userName" name="userName" placeholder="货主姓名"  />
</p>
<p class="contact-input">
    <input type="search" id="userMobile" name="userMobile" maxlength="11" placeholder="货主电话"  />
</p>
<p class="contact-submit">
    <input type="button" value="查询货主" onclick="getSenderPage()">
</p>

<SCRIPT LANGUAGE="JavaScript" type="">
    var senderThead = new Array(
            new XThead("货主"),
            new XThead("目的地"),
            new XThead("货物类型")
    );

    var senderXTable = new XTable("sender", senderThead);

    senderXTable.XTbodyArray = function (model) {
        var array = new Array(
                new XTbody("sender", "<a href='${ctx}/wx/page/task_manage.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}&staffType=${staffType}&taskId=${taskId}&taskType=${taskType}&senderUserId=" + model.userId + "'>" + model.user.userName + "</a>", null, null, null, "center"),
                new XTbody("sender", "<a href='tel:" + model.user.userMobile + "'>" + model.user.userMobile + "</a>", null, null, null, "center"),
                new XTbody("sender", model.senderLastDest + "<br/>" + model.senderLastGood, null, null, null, "center")
        );

        return array;
    }
    senderXTable.getXList = function (page){
        var user = new User();
        user.userName = dwr.util.getValue("userName");
        user.userMobile = dwr.util.getValue("userMobile");
        var sender = new Sender();
        sender.deptParentId = "${deptParentId}";
        sender.user = user;
        sender.pageIndex = page;
        sender.pageSize = senderXTable.pageSize;
        UserService.selectSenderList(sender, function(list){senderXTable.addTable(list);});
    }
    function getSenderPage(){
        var user = new User();
        user.userName = dwr.util.getValue("userName");
        user.userMobile = dwr.util.getValue("userMobile");
        var sender = new Sender();
        sender.deptParentId = "${deptParentId}";
        sender.user = user;
        UserService.selectSenderNum(sender, function(num){senderXTable.setTotalPage(num);});
    }
    getSenderPage();
</SCRIPT>
</body>
</html>